<?php

namespace Acme\ContestBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

use Symfony\Component\Validator\Constraints as Assert;

/**
 * Acme\ContestBundle\Entity\CtInfo
 *
 * @ORM\Table(name="ct_info")
 * @ORM\Entity(repositoryClass="Acme\ContestBundle\Repository\CtInfoRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class CtInfo
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入竞赛名称",
     * 		groups={"regist_default"}
     * )
     * @Assert\MinLength(
     * 		limit=4,
     * 		message="竞赛名称长度最少为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     * @Assert\MaxLength(
     * 		limit=20,
     * 		message="竞赛名称长度最多为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     */
    private $name;

    /**
     * @var integer $contestType
     *
     * @ORM\Column(name="contest_type", type="integer", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择比赛类型",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     */
    private $contestType;

    /**
     * @var string $isVisiable
     *
     * @ORM\Column(name="is_visiable", type="string", length=1, nullable=true)
     */
    private $isVisiable;

    /**
     * @var integer $createdBy
     *
     * @ORM\Column(name="created_by", type="integer", nullable=true)
     */
    private $createdBy;

    /**
     * @var datetime $createdTime
     *
     * @ORM\Column(name="created_time", type="datetime", nullable=true)
     */
    private $createdTime;

    /**
     * @var integer $approver
     *
     * @ORM\Column(name="approver", type="integer", nullable=true)
     */
    private $approver;

    /**
     * @var datetime $approveTime
     *
     * @ORM\Column(name="approve_time", type="datetime", nullable=true)
     */
    private $approveTime;

    /**
     * @var integer $modifiedBy
     *
     * @ORM\Column(name="modified_by", type="integer", nullable=true)
     */
    private $modifiedBy;

    /**
     * @var datetime $modifiedTime
     *
     * @ORM\Column(name="modified_time", type="datetime", nullable=true)
     */
    private $modifiedTime;
    
    /**
     * @var integer $applyBy
     *
     * @ORM\Column(name="apply_by", type="integer", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择比赛申请人"
     * )
     */
    private $applyBy;

    /**
     * @var string $applyState
     *
     * @ORM\Column(name="apply_state", type="string", length=1, nullable=true)
     */
    private $applyState;

    /**
     * @var datetime $applyTime
     *
     * @ORM\Column(name="apply_time", type="datetime", nullable=true)
     */
    private $applyTime;

    /**
     * @var text $applyReason
     *
     * @ORM\Column(name="apply_reason", type="text", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入竞赛申请原因",
     * 		groups={"regist_default"}
     * )
     * @Assert\MinLength(
     * 		limit=10,
     * 		message="竞赛申请原因长度最少为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     * @Assert\MaxLength(
     * 		limit=50,
     * 		message="竞赛申请原因长度最多为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     */
    private $applyReason;

    /**
     * @var datetime $enrollStart
     *
     * @ORM\Column(name="enroll_start", type="datetime", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择报名开始时间",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $enrollStart;

    /**
     * @var datetime $enrollEnd
     *
     * @ORM\Column(name="enroll_end", type="datetime", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择报名结束时间",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $enrollEnd;

    /**
     * @var datetime $contestStart
     *
     * @ORM\Column(name="contest_start", type="datetime", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择竞赛开始时间",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $contestStart;

    /**
     * @var datetime $contestEnd
     *
     * @ORM\Column(name="contest_end", type="datetime", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择竞赛结束时间",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $contestEnd;

    /**
     * @var string $reviewType
     *
     * @ORM\Column(name="review_type", type="string", length=1, nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择竞赛评估类型",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     */
    private $reviewType;

    /**
     * @var datetime $reviewStart
     *
     * @ORM\Column(name="review_start", type="datetime", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择竞赛评审开始时间",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $reviewStart;

    /**
     * @var datetime $reviewEnd
     *
     * @ORM\Column(name="review_end", type="datetime", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请选择竞赛评审开始时间",
     * 		groups={"regist_student", "regist_teacher"}
     * )
     * @Assert\Date()
     */
    private $reviewEnd;

    /**
     * @var text $instruction
     *
     * @ORM\Column(name="instruction", type="text", nullable=true)
     * 
     * @Assert\NotBlank(
     * 		message = "请输入竞赛说明",
     * 		groups={"regist_default"}
     * )
     * @Assert\MinLength(
     * 		limit=10,
     * 		message="竞赛说明长度最少为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     * @Assert\MaxLength(
     * 		limit=200,
     * 		message="竞赛说明长度最多为 {{ limit }} 位字符",
     * 		groups={"regist_default"}
     * )
     */
    private $instruction;

    /**
     * @var string $flag
     *
     * @ORM\Column(name="flag", type="string", length=1, nullable=true)
     */
    private $flag;
    
    /**
     * Owning Side
     * @ORM\ManyToOne(targetEntity="\Acme\CommonBundle\Entity\ConstContestType", inversedBy="contests")
     * @ORM\JoinColumn(name="contest_type", referencedColumnName="id")
     */
    protected $contestTypeInfo;
    
    /**
     * Owning Side
     * @ORM\ManyToOne(targetEntity="\Acme\UserBundle\Entity\CmUser", inversedBy="applyContests")
     * @ORM\JoinColumn(name="apply_by", referencedColumnName="id")
     */
    protected $applyByInfo;



    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set contestType
     *
     * @param integer $contestType
     */
    public function setContestType($contestType)
    {
        $this->contestType = $contestType;
    }

    /**
     * Get contestType
     *
     * @return integer 
     */
    public function getContestType()
    {
        return $this->contestType;
    }

    /**
     * Set isVisiable
     *
     * @param string $isVisiable
     * 
     * @ORM\prePersist
     */
    public function setIsVisiable($isVisiable = 0)
    {
        $this->isVisiable = $isVisiable;
    }

    /**
     * Get isVisiable
     *
     * @return string 
     */
    public function getIsVisiable()
    {
        return $this->isVisiable;
    }

    /**
     * Set createdBy
     *
     * @param integer $createdBy
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;
    }

    /**
     * Get createdBy
     *
     * @return integer 
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set createdTime
     *
     * @param datetime $createdTime
     * 
     * @ORM\prePersist
     */
    public function setCreatedTime()
    {
        $this->createdTime = new \DateTime();
    }

    /**
     * Get createdTime
     *
     * @return datetime 
     */
    public function getCreatedTime()
    {
        return $this->createdTime;
    }

    /**
     * Set approver
     *
     * @param integer $approver
     */
    public function setApprover($approver)
    {
        $this->approver = $approver;
    }

    /**
     * Get approver
     *
     * @return integer 
     */
    public function getApprover()
    {
        return $this->approver;
    }

    /**
     * Set approveTime
     *
     * @param datetime $approveTime
     */
    public function setApproveTime($approveTime)
    {
        $this->approveTime = $approveTime;
    }

    /**
     * Get approveTime
     *
     * @return datetime 
     */
    public function getApproveTime()
    {
        return $this->approveTime;
    }

    /**
     * Set modifiedBy
     *
     * @param integer $modifiedBy
     */
    public function setModifiedBy($modifiedBy)
    {
        $this->modifiedBy = $modifiedBy;
    }

    /**
     * Get modifiedBy
     *
     * @return integer 
     */
    public function getModifiedBy()
    {
        return $this->modifiedBy;
    }

    /**
     * Set modifiedTime
     *
     * @param datetime $modifiedTime
     * 
     * @ORM\preUpdate
     */
    public function setModifiedTime()
    {
        $this->modifiedTime = new \DateTime();
    }

    /**
     * Get modifiedTime
     *
     * @return datetime 
     */
    public function getModifiedTime()
    {
        return $this->modifiedTime;
    }
    
    /**
     * Set applyBy
     *
     * @param integer $applyBy
     */
    public function setApplyBy($applyBy)
    {
    	$this->applyBy = $applyBy;
    }
    
    /**
     * Get applyBy
     *
     * @return integer
     */
    public function getApplyBy()
    {
    	return $this->applyBy;
    }

    /**
     * Set applyState
     *
     * @param string $applyState
     * 
     * @ORM\prePersist
     */
    public function setApplyState($applyState = 2)
    {
        $this->applyState = $applyState;
    }

    /**
     * Get applyState
     *
     * @return string 
     */
    public function getApplyState()
    {
        return $this->applyState;
    }

    /**
     * Set applyTime
     *
     * @param datetime $applyTime
     */
    public function setApplyTime($applyTime)
    {
        $this->applyTime = $applyTime;
    }

    /**
     * Get applyTime
     *
     * @return datetime 
     */
    public function getApplyTime()
    {
        return $this->applyTime;
    }

    /**
     * Set applyReason
     *
     * @param text $applyReason
     */
    public function setApplyReason($applyReason)
    {
        $this->applyReason = $applyReason;
    }

    /**
     * Get applyReason
     *
     * @return text 
     */
    public function getApplyReason()
    {
        return $this->applyReason;
    }

    /**
     * Set enrollStart
     *
     * @param datetime $enrollStart
     */
    public function setEnrollStart($enrollStart)
    {
        $this->enrollStart = $enrollStart;
    }

    /**
     * Get enrollStart
     *
     * @return datetime 
     */
    public function getEnrollStart()
    {
        return $this->enrollStart;
    }

    /**
     * Set enrollEnd
     *
     * @param datetime $enrollEnd
     */
    public function setEnrollEnd($enrollEnd)
    {
        $this->enrollEnd = $enrollEnd;
    }

    /**
     * Get enrollEnd
     *
     * @return datetime 
     */
    public function getEnrollEnd()
    {
        return $this->enrollEnd;
    }

    /**
     * Set contestStart
     *
     * @param datetime $contestStart
     */
    public function setContestStart($contestStart)
    {
        $this->contestStart = $contestStart;
    }

    /**
     * Get contestStart
     *
     * @return datetime 
     */
    public function getContestStart()
    {
        return $this->contestStart;
    }

    /**
     * Set contestEnd
     *
     * @param datetime $contestEnd
     */
    public function setContestEnd($contestEnd)
    {
        $this->contestEnd = $contestEnd;
    }

    /**
     * Get contestEnd
     *
     * @return datetime 
     */
    public function getContestEnd()
    {
        return $this->contestEnd;
    }

    /**
     * Set reviewType
     *
     * @param string $reviewType
     */
    public function setReviewType($reviewType)
    {
        $this->reviewType = $reviewType;
    }

    /**
     * Get reviewType
     *
     * @return string 
     */
    public function getReviewType()
    {
        return $this->reviewType;
    }

    /**
     * Set reviewStart
     *
     * @param datetime $reviewStart
     */
    public function setReviewStart($reviewStart)
    {
        $this->reviewStart = $reviewStart;
    }

    /**
     * Get reviewStart
     *
     * @return datetime 
     */
    public function getReviewStart()
    {
        return $this->reviewStart;
    }

    /**
     * Set reviewEnd
     *
     * @param datetime $reviewEnd
     */
    public function setReviewEnd($reviewEnd)
    {
        $this->reviewEnd = $reviewEnd;
    }

    /**
     * Get reviewEnd
     *
     * @return datetime 
     */
    public function getReviewEnd()
    {
        return $this->reviewEnd;
    }

    /**
     * Set instruction
     *
     * @param text $instruction
     */
    public function setInstruction($instruction)
    {
        $this->instruction = $instruction;
    }

    /**
     * Get instruction
     *
     * @return text 
     */
    public function getInstruction()
    {
        return $this->instruction;
    }

    /**
     * Set flag
     *
     * @param string $flag
     * 
     * @ORM\prePersist
     */
    public function setFlag($flag = 0)
    {
        $this->flag = $flag;
    }

    /**
     * Get flag
     *
     * @return string 
     */
    public function getFlag()
    {
        return $this->flag;
    }

    /**
     * Set contestTypeInfo
     *
     * @param Acme\CommonBundle\Entity\ConstContestType $contestTypeInfo
     */
    public function setContestTypeInfo(\Acme\CommonBundle\Entity\ConstContestType $contestTypeInfo)
    {
        $this->contestTypeInfo = $contestTypeInfo;
    }

    /**
     * Get contestTypeInfo
     *
     * @return Acme\CommonBundle\Entity\ConstContestType 
     */
    public function getContestTypeInfo()
    {
        return $this->contestTypeInfo;
    }

    /**
     * Set applyByInfo
     *
     * @param Acme\UserBundle\Entity\CmUser $applyByInfo
     */
    public function setApplyByInfo(\Acme\UserBundle\Entity\CmUser $applyByInfo)
    {
        $this->applyByInfo = $applyByInfo;
    }

    /**
     * Get applyByInfo
     *
     * @return Acme\UserBundle\Entity\CmUser 
     */
    public function getApplyByInfo()
    {
        return $this->applyByInfo;
    }
}